<!DOCTYPE html>
<html lang="en" style="font-size: 100px;">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>rem适配</title>
    <style>
        *{margin: 0;padding:0;box-sizing: border-box}
        #banner{
            width: 3.35rem;
            height: 1.44rem;
            margin: 0.97rem auto;
            background: #eaf;
        }
    </style>
</head>
<body>
    <div id="banner"></div>
    <script>
        //适配
        function adapter(){
            //修改  document.getElementsByTagName('html')[0]
            document.documentElement.style.fontSize = document.documentElement.clientWidth * 100 / 375 + 'px';
        }
        adapter();

        //事件  当布局视口的大小发生改变之后, 触发的事件
        window.onresize = function(){
            adapter();
        }
    </script>
</body>
</html>